<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../lib/echarts.min.js"></script>
</head>

<body>
  <div id="echarts" style="width: 600px;height:400px;border:1px solid red"></div>
  <!-- axios -->
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.0/axios.min.js"></script>
  <script>
    let mCharts = echarts.init(document.getElementById('echarts'))

    async function getData() {
      const { data: anhui } = await axios.get('./map/anhui.json')
      console.log(anhui)

      if (anhui) {
        echarts.registerMap('chinaMap', anhui)
        let option = {
          geo: {
            type: 'map',
            map: 'chinaMap',
            roam: true,//允许拖动及缩放
            label: {
              // 显示默认标签名称
              show: true
            },
            zoom: 1.2,//默认缩放比例
            // center: [118.317325, 29.709239]
          }
        }
        mCharts.setOption(option)
      }
    }
    getData()


  </script>
</body>

</html>